package com.daocao.yfb.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import com.daocao.yfb.R;
import com.daocao.yfb.api.model.NoticeListModel;
import com.daocao.yfb.util.DateTime;


/**
 * Created by xsooy-pc on 2017/10/23.
 */

public class MsgTipsItemAdapter extends ItemAdapter<NoticeListModel.DatasBean, MsgTipsItemAdapter.DefaultHolder> {




    public MsgTipsItemAdapter(Context context) {
        super(context);
    }

    @Override
    public DefaultHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new DefaultHolder(inflate(R.layout.item_order_msg, parent));
    }

    @Override
    public void onBindViewHolder(DefaultHolder holder, int position) {
        NoticeListModel.DatasBean item = getItem(position);
        holder.txtTitle.setText(item.title);
        holder.txtContent.setText(item.content);
        holder.txtTime.setText(DateTime.toDate(item.time*1000));

    }

    class DefaultHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.txt_title)
        TextView txtTitle;
        @BindView(R.id.txt_content)
        TextView txtContent;
        @BindView(R.id.txt_time)
        TextView txtTime;
        public DefaultHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
